<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<div class="am-fl">共 ${pager.itemtotal}条记录/共${pager.pagetotal}页 </div>
<div class="am-g am-padding-horizontal-sm">
	<div class="am-u-sm-12">
		<div class="am-fr">
			<ul class="am-pagination">
				<!-- 开始构建要使用的分页的信息 -->
				<div class="am-cf" style="margin-left: -40%" >
					<div class="am-fr">
						<ul class="am-pagination">
							<li class="am-disabled" id="upto"><span onclick="upto()">«上一页</span></li>
							<li class="am-active"><input style="width: 40px;text-align: center;color: black;"  id="pageNumberto" value="${pager.pagenumber}"/></li>
							<li class="am-active"><span onclick="jumpto()">跳转</span></li>
							<li class="am-disabled" id="downto"><span onclick="downto()">下一页»</span></li>
						</ul>
					</div>
				</div>
			</ul>
		</div>
	</div>
</div>
<script type="text/javascript">
	function upto(){
		if((${pager.pagenumber})>1){
			var r="?";
			if(('${curl}').indexOf(r)>-1){
				window.location.href="${curl}&pageNum=${pager.pagenumber-1}";
			}else{
				window.location.href="${curl}?pageNum=${pager.pagenumber-1}";
			}
		}
	}

	function jumpto(){
		var pageNum=$("#pageNumberto").val();
		var r="?";
		if(('${curl}').indexOf(r)>-1){
			window.location.href="${curl}&pageNum="+pageNum;
		}else{
			window.location.href="${curl}?pageNum="+pageNum;
		}
	}

	function downto(){
		if((${pager.pagenumber})<(${pager.pagetotal})){
			var r="?";
			if(('${curl}').indexOf(r)>-1){
				window.location.href="${curl}&pageNum=${pager.pagenumber+1}";
			}else{
				window.location.href="${curl}?pageNum=${pager.pagenumber+1}";
			}
		}
	}

	function changePagerData(){
		//处理上一页的部分
		if((${pager.pagenumber})>1){
			$("#upto").removeClass();
			$("#upto").addClass("am-active");
		}else{
			$("#upto").removeClass();
			$("#upto").addClass("am-disabled");
		}
		//处理下一页的部分
		if((${pager.pagenumber})<(${pager.pagetotal})){
			$("#downto").removeClass();
			$("#downto").addClass("am-active");
		}else{
			$("#downto").removeClass();
			$("#downto").addClass("am-disabled");
		}
	}

	setTimeout("changePagerData()",10);
</script>